package nancal.mp

import nancal.mp.db.mongo.JenkinsLanguageEnum
import nancal.mp.db.mongo.entity.dev.AppDeployPipelineHook
import nancal.mp.db.mongo.entity.dev.AppDeploySetting
import nancal.mp.db.mongo.entity.dev.JenkinsDependencyCheckDefine
import nancal.mp.db.mongo.entity.dev.JenkinsServer
import nancal.mp.db.mongo.mor
import nbcp.myoql.db.mongo.updateWithEntity
import org.junit.jupiter.api.Test

class InsertInitDataTest : TestBase() {

    @Test
    fun initData_k8s_dev() {
        var appDeploySetting = AppDeploySetting();
        appDeploySetting.code = "dev";
        appDeploySetting.name = "开发213"
        appDeploySetting.jenkinsServer = JenkinsServer("http://192.168.5.217:8080", "admin", "1234")
        appDeploySetting.k8sConfig.kubeConfigContent = """apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1ETXhOekExTWpJd09Wb1hEVE14TURNeE5UQTFNakl3T1Zvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBS1JLCjNqbExsSUtSdjVNNWUwZzZkV2pZUU9uL0lRbTFUR2NscU9LcW0xM2o3eXV3bzQvYmRnbXh4Z3NlVWdzNDR3aWwKa0pLZE9BRzBsUUFhY0tZUUtVZS9UcFdkeEIwU0h6YWhqL3FQTGM0WU1PZTN6NW9XTVZ4NTIrSS8rTHpCYS90cwo0UTg2ME5hQ2hBZEtIWDJYZVRpMEdoanlMOXpPMGxpcVJhK3E4Yzd3OWxEK2JiaDM1YlYyY1lSWGxPZlgvbmlWCmJhSlNOZFFQS1hCMUlNemNLVGVvbXZrQWNXRzZjdmE5cUpUaWcvRk5WNXVUekNtZDVPVVBrSTNMNVZMc2wwdk0KVDZGQnJuckdURGlia1dwR1NSd0l3RDJCUy9mbTV5S0J3N1lHVWg3bWlYM01YZ01URUJRZ1R4RjNCMU8yeEl0UwpHRFpMNXpPVnlsSzRqYVNuUHc4Q0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFBQkxiOVNtdVVVckZsTXJxMmoydmZrMHZhT2wKS2MxK0ZFaHpFSnUxT3ZXWEd6R0pmVndWQmNNMzdCODIzbDlqc0V6bkpnNVlkemprc1ZnRUhaNURxbGZLQ1l0TQp6aS9sUUh1UWhybHFFdE9ZcVhneVRPcGd5Zm5PanAxN2h0NGh1UHhhazB4MWw1VXYrVXYrelVsSFRvelA0d242ClgyR1h3b0pWalV6NCtNdWZGbzhlVjNKMU9hVGE4ZG5Tcm9QcGdjRWhreTVFNUdlUEdmc2JmbEEvZE9aeU9JaHUKTS96ZDlEQXJadG50eXhtZXpTcmMwLzhVM2lyZlg3Wm4rQkMwd0UyTGVzeCs2WVhZeXlWWDl2MnAxWDhsSFZyTgpOSWNPbHBFUDhybVBCMllBQ21HcXZ1MEI4T3pqYVpCb1lta1Zlb3R1azBFYlZlbDFnQ1NQbitXT1BjRT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://172.16.250.2:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJUkptRzNBaU5BWDB3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRBek1UY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VVMrVDh4NzUrUGFpVnQrU0FZNGtTMzczKzdpMU1lMnA4OVdGUU9ub0RackplN3hnOEYzRlBwSmdBeVhrR3NMCm9PbjdBb0dCQU51RkN4dURTdDBEcTRkdExxcGhBTis5SCswN3Z0c1ZkQnFBRWpjNUlWL2FyVG16US8yNGIzbHkKZGRKdkQzWHFQZHMrcmJ0RFR0Q0Z6TDZNZ0VxVWJML1l5cDdwSDY3cUJRaXVQU1dsQnZxd0h4SmlFZTMvd0pocAp6OXdaWnFyaVJIT1BqU2FVY01sd3V3ODJTeXVsNmpIRDVGa3Qwb3lSNVg2MGVQZjN3Y0NxCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
"""

        appDeploySetting.k8sConfig.apiServerHost = "https://172.16.250.2:6443"
        appDeploySetting.k8sConfig.apiToken =
            """eyJhbGciOiJSUzI1NiIsImtpZCI6IkZjalVmUFlyeF9ZSmNFaHJ6NUdJclNBdERCdWloNkE4SUV0MWRXS19YTGcifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXVzZXItdG9rZW4ta2xwbTgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3Vib2FyZC11c2VyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiODk1Njk5MGQtYjgwNC00ODFmLTg4YWMtNWM0MDMyMzBhNjJlIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmt1Ym9hcmQtdXNlciJ9.UMaOkWBk7aUp1ahZl316xIY_GwRw22uEFUIo9yMpE92vFlL1voHlq7vxb6s6zhPjeFON8y8658U3qam4UQqkDfIT5UYWzryWwB6V0IrZzunzoX0WZWB2-BMX3qSnAxmPSaaqbi_WTb1S4R54oNzZaOWkYsinYr4h1tyXYZR737yNY4ZV9mgs72zY52wkOJA8zskmWMAwm9Z8aZiDBN3p-Sx_PKAUBmjYJn5yZlOfWtWSabVqbpS2lrrVpnYXeAWvRs34e7tI1eM3Yq5sRPtiUNvvvGTT_CVC4P7Pui9sMcK1TMWFLb2wM6T05UHXlkB2CjjVzTDRi_PUyc3G9yon3g"""
        mor.dev.appDeploySetting.updateWithEntity(appDeploySetting)
            .whereColumn { it.code }
            .doubleExecSave();
    }

    @Test
    fun initData_k8s_test() {
        var appDeploySetting = AppDeploySetting();
        appDeploySetting.code = "test";
        appDeploySetting.name = "测试214"
        appDeploySetting.jenkinsServer = JenkinsServer("http://192.168.5.218:8080", "admin", "1234")
        appDeploySetting.k8sConfig.kubeConfigContent = """apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1ETXhOekExTWpRMU1Wb1hEVE14TURNeE5UQTFNalExTVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTG5FCkZjQ3liWUNQc2RjM0JuKzdLekMzaUlGSVJtQkpnbmlEcnNYUHl6ZVhxOUdiN1Nyb0VaYW8rdW5QVjY4cFZkL0oKNU9BVnBEeU9KYTBtOTJIWXNRV1ZiQnBoNGp4ajhiZXFqa1FZU2pmcUVlZlJFOSt5MjlVbGVrNC85SEVLaVVXTwpSYk9OL2pyMjZYWGhYeGZWUHdNa0E0b2xoZTAzNXhSVE5acjJkU2thQlhNTXE0TExIREFpMkNzd3F6Yk1JTmY1CjBJQ3g5WnN3Y2JhRmNKWC95Ky9kNlpXb1FBdVFNRmdjb1ZDU1dWaDhtYzlNbEJqcjl5cHVrWXdMWlNCT0FjRFIKT1pVSCtlTk0vVXIyKy9wUHkyZloxc0Nmako5dlNtUnBmU2ZWdUIrb1hIT2p2Y2EwNkZwclZyMy9LVlBpSzRFRQpPTjRmRG4yMFQ3d2lFdHBEc3djQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFKa1RETlJhMzhLTE5EeWYzNmx2d3ZramEydXAKSHljRW1VWE5mdTRidDhwSVpWb0FaQ1ZjYkhjZzk4Yk1QbXVTY0JuaGpYYmZFMkxPU1JoWURRVEdqOUdtSUpxUwpDMnVTNVRERG9XVjdEZGtjNlhvaHJOOGluejR5alh1Y1JERnI1alNaMjl3WnVrWFo1NDZzcG5Rc1ZMSndhM20rCkVRYmR3M1FrZS9KZHVWZndtTDVHanBVNVlqUUVkVnFaTGJEVGFsQU1Xc3U0NExjdm1zeE4vbVNPbitoQkV1Y2wKSGlXRVNlbzZTQWZZOHQ0MGo5NVlXcUN5U0RmVmwrd0JyT2FmblA3UFFIQXc3Y0VsSklDNGczdlBFR0tMMWphbQpYZ2FPUFRmdkVBREZzMEQrZmk4eUZRMyt6enBreWFYRW8rRVFSV1VsV2ZsM0RrRjh1UkhtMDdDWm1BST0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://172.16.250.50:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1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KaFVOOUR0WkVUSDR4MkVaLzlSb015UUNyaGcveXlzVHQrdVVWc2t3SXlvRno0QUlzeGlEU1UwRnEyM2J4bDZSUQpXeDF2V2orYzFPMzQvS1puclh1TjFyWmUrOG9URFc1SEZLb3BPR1lyVU9WSVJXbzErYVQ3QWUzRWpNdFdVTEplCmhvMDVVVlVDZ1lFQTJCWE93SW5GMW9TRG05T0xzems0WTQrN0tBUmpjRXBUWG1jT3F0cTVPV0xvbUZsVnZ5WVgKdG5LY2dtdWNuUjRlTGViQ0dZa0hYeUpRaTJJd1VzSVU0R1Z0RE5HNmloL2I0RUpWMXBLQkp0bFJkdVhKUHhWQQo2WXMxZENZVkVIMDZZMkxVenZaVWZaelBjR0s0WmdPQ1FIcHdMNjJxTTJ6SEZJckd4WkYwdE1zPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
"""


        appDeploySetting.k8sConfig.apiServerHost = """https://172.16.250.50:6443"""
        appDeploySetting.k8sConfig.apiToken =
            """eyJhbGciOiJSUzI1NiIsImtpZCI6Il80VGNsZmlfX3kzaXVHS2N3WnU4dUNGOW5hVko0UGg2MHE3Y0pEdmRwWmsifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXVzZXItdG9rZW4tNTlqa2QiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3Vib2FyZC11c2VyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYmVkMjJhYzMtNTE0MS00N2I3LWJhNjMtODA2NzA3MzM1NmMzIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmt1Ym9hcmQtdXNlciJ9.GTDGDKWg8fQzgK1CXEDD0cv-g0w1r_grF36sPzerGY9ColAFIvXJ1pNAG784Zrbt76GZBHEV57iIPgO35Wc_JXEVPoHWRwz_B2tZ5nnIoXBORGm0uQS75oyI2ogYBQppTYgfLDNGD8DfuTQzU4j1IKvVxiLnqdJqQMftcAbuZCMPSq3P0S0TUTu8qEU131oK8zTaMfnMR-il6vvhn0w3EZv0nyB52d183nwA-0b0WOYsizzFfn9RgCNH-iZMi9wVp-e-lYJVlURi-BsVh-oW6OKe3bCGB0hpnrGpdfdy5wh46lRjpU1soZbw9b8UJbleYjG-uecflv_xKKHuD19sjQ"""
        mor.dev.appDeploySetting.updateWithEntity(appDeploySetting)
            .whereColumn { it.code }
            .doubleExecSave();
    }

    @Test
    fun initData_k8s_local() {
        var appDeploySetting = AppDeploySetting();
        appDeploySetting.code = "yuxh";
        appDeploySetting.name = "本地"
        appDeploySetting.jenkinsServer = JenkinsServer("http://192.168.5.217:8080", "admin", "1234")
        appDeploySetting.k8sConfig.kubeConfigContent = """apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1ETXhOekExTWpJd09Wb1hEVE14TURNeE5UQTFNakl3T1Zvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBS1JLCjNqbExsSUtSdjVNNWUwZzZkV2pZUU9uL0lRbTFUR2NscU9LcW0xM2o3eXV3bzQvYmRnbXh4Z3NlVWdzNDR3aWwKa0pLZE9BRzBsUUFhY0tZUUtVZS9UcFdkeEIwU0h6YWhqL3FQTGM0WU1PZTN6NW9XTVZ4NTIrSS8rTHpCYS90cwo0UTg2ME5hQ2hBZEtIWDJYZVRpMEdoanlMOXpPMGxpcVJhK3E4Yzd3OWxEK2JiaDM1YlYyY1lSWGxPZlgvbmlWCmJhSlNOZFFQS1hCMUlNemNLVGVvbXZrQWNXRzZjdmE5cUpUaWcvRk5WNXVUekNtZDVPVVBrSTNMNVZMc2wwdk0KVDZGQnJuckdURGlia1dwR1NSd0l3RDJCUy9mbTV5S0J3N1lHVWg3bWlYM01YZ01URUJRZ1R4RjNCMU8yeEl0UwpHRFpMNXpPVnlsSzRqYVNuUHc4Q0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFBQkxiOVNtdVVVckZsTXJxMmoydmZrMHZhT2wKS2MxK0ZFaHpFSnUxT3ZXWEd6R0pmVndWQmNNMzdCODIzbDlqc0V6bkpnNVlkemprc1ZnRUhaNURxbGZLQ1l0TQp6aS9sUUh1UWhybHFFdE9ZcVhneVRPcGd5Zm5PanAxN2h0NGh1UHhhazB4MWw1VXYrVXYrelVsSFRvelA0d242ClgyR1h3b0pWalV6NCtNdWZGbzhlVjNKMU9hVGE4ZG5Tcm9QcGdjRWhreTVFNUdlUEdmc2JmbEEvZE9aeU9JaHUKTS96ZDlEQXJadG50eXhtZXpTcmMwLzhVM2lyZlg3Wm4rQkMwd0UyTGVzeCs2WVhZeXlWWDl2MnAxWDhsSFZyTgpOSWNPbHBFUDhybVBCMllBQ21HcXZ1MEI4T3pqYVpCb1lta1Zlb3R1azBFYlZlbDFnQ1NQbitXT1BjRT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
    server: https://k8s-master01:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes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k1Z1J4U0pJRld3dmMrN2NXWDBIRXJWYzZECjNmWGdlMWhjUENpa3JnRStFQVBWZVFLQmdGNjVxM1Q4VzIxd2FUTk1FbmNNaEQycVQzUDNCUEU4VHphU09wK3IKU3lSa3lXVGxOKy9hMllnSnQ2TTZSZThGSGE2ZW9ncGxRazM2WXRqWlpjSitvOGtuMDJJSW1sK1ZSTG9NQlBwegpzVVMrVDh4NzUrUGFpVnQrU0FZNGtTMzczKzdpMU1lMnA4OVdGUU9ub0RackplN3hnOEYzRlBwSmdBeVhrR3NMCm9PbjdBb0dCQU51RkN4dURTdDBEcTRkdExxcGhBTis5SCswN3Z0c1ZkQnFBRWpjNUlWL2FyVG16US8yNGIzbHkKZGRKdkQzWHFQZHMrcmJ0RFR0Q0Z6TDZNZ0VxVWJML1l5cDdwSDY3cUJRaXVQU1dsQnZxd0h4SmlFZTMvd0pocAp6OXdaWnFyaVJIT1BqU2FVY01sd3V3ODJTeXVsNmpIRDVGa3Qwb3lSNVg2MGVQZjN3Y0NxCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
"""

        appDeploySetting.k8sConfig.apiServerHost = "https://k8s-master01:6443"
        appDeploySetting.k8sConfig.apiToken =
            """eyJhbGciOiJSUzI1NiIsImtpZCI6IkZjalVmUFlyeF9ZSmNFaHJ6NUdJclNBdERCdWloNkE4SUV0MWRXS19YTGcifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJvYXJkLXVzZXItdG9rZW4ta2xwbTgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoia3Vib2FyZC11c2VyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiODk1Njk5MGQtYjgwNC00ODFmLTg4YWMtNWM0MDMyMzBhNjJlIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmt1Ym9hcmQtdXNlciJ9.UMaOkWBk7aUp1ahZl316xIY_GwRw22uEFUIo9yMpE92vFlL1voHlq7vxb6s6zhPjeFON8y8658U3qam4UQqkDfIT5UYWzryWwB6V0IrZzunzoX0WZWB2-BMX3qSnAxmPSaaqbi_WTb1S4R54oNzZaOWkYsinYr4h1tyXYZR737yNY4ZV9mgs72zY52wkOJA8zskmWMAwm9Z8aZiDBN3p-Sx_PKAUBmjYJn5yZlOfWtWSabVqbpS2lrrVpnYXeAWvRs34e7tI1eM3Yq5sRPtiUNvvvGTT_CVC4P7Pui9sMcK1TMWFLb2wM6T05UHXlkB2CjjVzTDRi_PUyc3G9yon3g"""
        mor.dev.appDeploySetting.updateWithEntity(appDeploySetting)
            .whereColumn { it.code }
            .doubleExecSave();
    }


    @Test
    fun initData_k8s_lecanguat() {
        var appDeploySetting = AppDeploySetting();
        appDeploySetting.code = "lecang-uat";
        appDeploySetting.name = "lecang-uat"
        appDeploySetting.k8sConfig.apiServerHost =
            "https://k8s-master01:6443" //http://119.3.163.34:31004/
        appDeploySetting.k8sConfig.apiToken =
            """eyJhbGciOiJSUzI1NiIsImtpZCI6InVoTTVWZ01Fd0tSSHVMWXhqd21jZm1RbzZJSDNJUDdsdF9TU1AwMFF6OWMifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJwcmVwYXJlIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im5hbmNhbC10b2tlbi01ZGxyaCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJuYW5jYWwiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI5ZThjZDY1OC04ZGI5LTQxMmItYWJhNi1jM2E4YTc3NTg2YWYiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6cHJlcGFyZTpuYW5jYWwifQ.u7nszYYGx2OHnGeGmuLRCaiXsCi0cW1cxL0qQHXEFGALF7ThctYPmAuQK3W-Q13VCLoYIvCFoy7U-U9YYn3AP2QaT1-miOfH9EIK3XxAOjee3oupyUa1r-2fiLOVgs6V--Q7AsWmY2-T64-0oxnFj0fBRCj4ExmJL4_wP_CgJN9-ThB9bQenbTFJXoQ2jHUKUEuBzbLav4Vcqf9YhD94Yqcue7aDD8bSYcsqnQ_Y7XzTRH3yCKa2iPuVYFcRq62vEXkWl1iUhH-1OrM_zUyD_fBd1AHXk32CSVwdjs8Lsojh8Z9bcbS0uTxX0giUL-sEIIvrkzWadgfH5xzkoCxMdg"""
        mor.dev.appDeploySetting.updateWithEntity(appDeploySetting)
            .whereColumn { it.code }
            .doubleExecSave();
    }

    @Test
    fun initData_deploy_jenkins_hook_test() {
        AppDeployPipelineHook().also {
            it.language = JenkinsLanguageEnum.Java
            it.define = JenkinsDependencyCheckDefine(
                "io.springfox:springfox-swagger-ui",
                minVersion = "2.10.0"
            )

            mor.dev.appDeployPipelineHook.updateWithEntity(it).doubleExecSave()
        }

        AppDeployPipelineHook().also {
            it.language = JenkinsLanguageEnum.Java
            it.define = JenkinsDependencyCheckDefine(
                "io.springfox:springfox-swagger-ui",
                minVersion = "2.10.0"
            )

            mor.dev.appDeployPipelineHook.updateWithEntity(it).doubleExecSave()
        }
    }
}